<template>
  <span >
    <el-button type="primary" size="small" @click="dialogFormVisible = true" class="index" >
      修改</el-button>
    <el-dialog :append-to-body='true' title="修改信息" :visible.sync="dialogFormVisible" dialogFormVisible = true class="s">
      <el-form :model="form" class="pad">
        <el-form-item label="用户名" :label-width="formLabelWidth">
          <el-input size="small" v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="手机号码" :label-width="formLabelWidth">
          <el-input size="small" v-model="form.tele" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer pad">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="handlePut($event)">
          <span @click="dialogFormVisible = false">确认修改</span>
        </el-button>
      </div>
    </el-dialog>
  </span>
</template>

<script>
import axios from 'axios'
export default {
  name: 'putAdminUser',
  data () {
    return {
      dialogFormVisible: false,
      form: {
        name: '',
        tele: '',
        delivery: false,
        type: []
      },
      formLabelWidth: '120px'
    }
  },
  methods: {
    handlePut () {
      var id = this.$store.state.data
      console.log(this.$store.state.data)
      // var idArray={name:this.form.name,tele:this.form.tele};
      // var str = JSON.stringify(idArray);
      // console.log(idArray);
      axios.put(`http://trip.com/reception/adminUsers/put/${id}`, { name: this.form.name, tele: this.form.tele }).then(response => {
        console.log(response)
      })
      // this.tableData = this.tableData.filter(i => !idArray.includes(i.id));
    }
  }
}
</script>

<style>
.index{
 margin-left: 10px;
 z-index:3;
}
.s{
  z-index: 3000;
}
.pad {
  padding-right: 20px;
}
</style>
